import { createRouter, createWebHistory } from 'vue-router'
import home from '@/views/home/home.vue'
import det from '@/views/det/index.vue'
import dd from '@/views/dd/index.vue'


import index from '@/views/home/children/index.vue'
import cart from '@/views/home/children/cart.vue'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/home',
      name: 'home',
      component: home,
      children: [
        {
          path: 'index',
          name: 'index',
          component: index,
        },
        {
          path: 'cart',
          name: 'cart',
          component: cart,
        },
      ]
    },
    {
      path: "/",
      redirect: '/home/index'
    },
    {
      path: '/det/:goods_id',
      name: 'det',
      component: det,
    },
    {
      path: '/dd',
      name: 'dd',
      component: dd,
    }
  ],
})

export default router
